package com.mxpio.erp.equipment.service.impl;

import com.mxpio.erp.common.equipment.entity.EquipmentCheckCategory;
import com.mxpio.erp.common.equipment.entity.EquipmentCheckDetail;
import com.mxpio.erp.common.equipment.service.EquipmentCheckCategoryService;
import com.mxpioframework.jpa.JpaUtil;
import com.mxpioframework.jpa.query.Criteria;
import com.mxpioframework.jpa.query.Operator;
import com.mxpioframework.system.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;

/**
 * @Description: 点检类别
 * @Author: jeecg-boot
 * @Date:   2021-09-15
 * @Version: V1.0
 */
@Service
public class EquipmentCheckCategoryServiceImpl extends BaseServiceImpl<EquipmentCheckCategory> implements EquipmentCheckCategoryService {



	@Override
	@Transactional
	public void delMain(String id) {
        JpaUtil.lind(EquipmentCheckDetail.class).equal("categoryId", id).delete();
		delete(EquipmentCheckCategory.class,id);
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
        JpaUtil.lind(EquipmentCheckDetail.class).in("categoryId", idList).delete();

		Criteria c = Criteria.create().addCriterion("id", Operator.IN, idList);
		deleteBatch(EquipmentCheckCategory.class,c);
	}


}
